package com.ganzi.ganziserver.service.imp;

import com.ganzi.ganziserver.core.User;
import com.ganzi.ganziserver.dao.UserDao;
import com.ganzi.ganziserver.service.LoginService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImp implements LoginService {

    @Autowired
    UserDao userdao;

    @Override
    public User findByName(String name) {
        User u = null;
        if(StringUtils.isNotBlank(name)){
            try {
                u = userdao.findUserByName(name);
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }
        return u;
    }
}
